HAL CCB types migration

This section provides information about the HAL CCB types migration.

HAL CCB ECC multiplication curve parameters type definition

HAL1

HAL2

typedef struct
{
  uint32_t primeOrderSizeByte;
  uint32_t modulusSizeByte;
  uint32_t coefSignA;
  const uint8_t *pAbsCoefA;
  const uint8_t *pCoefB;
  const uint8_t *pModulus;
  const uint8_t *pPrimeOrder;
  const uint8_t *pPointX;
  const uint8_t *pPointY;

}CCB_ECCMulCurveParamTypeDef;
typedef struct
{
  uint32_t prime_order_size_byte;
  uint32_t modulus_size_byte;
  uint32_t coef_sign_a;
  const uint8_t *p_abs_coef_a;
  const uint8_t *p_coef_b;
  const uint8_t *p_modulus;
  const uint8_t *p_prime_order;
  const uint8_t *p_point_x;
  const uint8_t *p_point_y;
  hal_ccb_ctx_pool_buff_t ecc_pool_buffer;
} hal_ccb_ecc_mul_curve_param_t;

Note

In HAL1, The memory space is handled by local variables.

In HAL2, the ecc_pool_buffer is added to the curve parameters structure used as memory space for ECC internal calculation of CCB blob creation to avoid stack consumption.


HAL CCB ECDSA curve parameters type definition

HAL1

HAL2

typedef struct
{
  uint32_t primeOrderSizeByte;
  uint32_t modulusSizeByte;
  uint32_t coefSignA;
  const uint8_t *pAbsCoefA;
  const uint8_t *pCoefB;
  const uint8_t *pModulus;
  const uint8_t *pPrimeOrder;
  const uint8_t *pPointX;
  const uint8_t *pPointY;

} CCB_ECDSACurveParamTypeDef;
typedef struct
{
  uint32_t prime_order_size_byte;
  uint32_t modulus_size_byte;
  uint32_t coef_sign_a;
  const uint8_t *p_abs_coef_a;
  const uint8_t *p_coef_b;
  const uint8_t *p_modulus;
  const uint8_t *p_prime_order;
  const uint8_t *p_point_x;
  const uint8_t *p_point_y;
  hal_ccb_ctx_pool_buff_t ecdsa_pool_buffer;
} hal_ccb_ecdsa_curve_param_t;

Note

In HAL1, The memory space is handled by local variables.

In HAL2, the ecc_pool_buffer is added to the curve parameters structure used as memory space for ECC internal calculation of CCB blob creation to avoid stack consumption.


HAL CCB ECC scalar multiplication key Blob type definition

HAL1

HAL2

typedef struct
{
  uint32_t *pIV;
  uint32_t *pTag;
  uint32_t *pWrappedKey;
}CCB_ECCMulKeyBlobTypeDef;
typedef struct
{
  uint32_t *p_iv;
  uint32_t *p_tag;
  uint32_t *p_wrapped_key;
} hal_ccb_ecc_mul_key_blob_t;

HAL CCB ECDSA key Blob type definition

HAL1

HAL2

typedef struct
{
  uint32_t *pIV;
  uint32_t *pTag;
  uint32_t *pWrappedKey;
}CCB_ECDSAKeyBlobTypeDef;
typedef struct
{
  uint32_t *p_iv;
  uint32_t *p_tag;
  uint32_t *p_wrapped_key;
} hal_ccb_ecdsa_key_blob_t;

HAL CCB ECC scalar multiplication point type definition

HAL1

HAL2

typedef struct
{
  uint8_t *pPointX;
  uint8_t *pPointY;
} CCB_ECCMulPointTypeDef;
typedef struct
{
  uint8_t *p_point_x;
  uint8_t *p_point_y;
} hal_ccb_ecc_point_t;

HAL CCB ECDSA signature type definition

HAL1

HAL2

typedef struct
{
  uint8_t *pRSign;
  uint8_t *pSSign;
} CCB_ECDSASignTypeDef;
typedef struct
{
  uint8_t *p_r_sign;
  uint8_t *p_s_sign;
} hal_ccb_ecdsa_sign_t;

HAL CCB handle type definition

HAL1

HAL2

CCB_HandleTypeDef;
hal_ccb_handle_t;

HAL CCB RSA clear key type definition

HAL1

HAL2

typedef struct
{
  uint8_t *pExp;
  uint8_t *pPhi;
} CCB_RSAClearKeyTypeDef;
typedef struct
{
  uint8_t *p_exp;
  uint8_t *p_phi;
} hal_ccb_rsa_clear_key_t;

HAL CCB RSA modular exponentiation key Blob type definition

HAL1

HAL2

typedef struct
{
  uint32_t *pIV;
  uint32_t *pTag;
  uint32_t *pWrappedExp;
  uint32_t *pWrappedPhi;
} CCB_RSAKeyBlobTypeDef;
typedef struct
{
  uint32_t *p_iv;
  uint32_t *p_tag;
  uint32_t *p_wrapped_exp;
  uint32_t *p_wrapped_phi;
} hal_ccb_rsa_key_blob_t;

HAL CCB RSA modular exponentiation parameters type definition

HAL1

HAL2

typedef struct
{
  uint32_t expSizeByte;
  uint32_t modulusSizeByte;
  const uint8_t *pMod;

} CCB_RSAParamTypeDef;
typedef struct
{
  uint32_t exp_size_byte;
  uint32_t modulus_size_byte;
  const uint8_t *p_mod;
  hal_ccb_ctx_pool_buff_t rsa_pool_buffer;
} hal_ccb_rsa_param_t;

Note

In HAL1, the memory space is handled by local variables.

In HAL2, the ecc_pool_buffer is added to the curve parameters structure used as memory space for ECC internal calculation of CCB blob creation to avoid stack consumption.


HAL CCB wrapping key type definition

HAL1

HAL2

typedef struct
{
  uint32_t WrappingKeyType;





  uint32_t AES_Algorithm;
  uint32_t *pInitVect;



  uint32_t *pUserWrappedWrappingKey;
} CCB_WrappingKeyTypeDef;
typedef enum
{
  HAL_CCB_KEY_HW,
  HAL_CCB_KEY_HSW
} hal_ccb_wrapping_hw_key_type_t;

typedef struct
{
  hal_ccb_aes_chaining_mode_t        aes_algorithm;
  uint32_t                           *p_init_vect;
  uint32_t                            key_size;
} hal_ccb_wrapping_sw_key_context_t;

In HAL2, pUserWrappedWrappingKey is replaced by the Wrapped_key_Buffer parameter, which is passed directly as an argument to the API.

Example Usage

HAL1

HAL2

/* Configure Wrapped Key */

wrappedKeyConf.WrappingKeyType         = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect               = AESIV;
wrappedKeyConf.AES_Algorithm           = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;

HAL_CCB_ECC_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf);
/* Configure Wrapped Key */
uint32_t Wrapped_key_Buffer[8] = {0};

wrappedKeyConf.p_init_vect                 = AESIV;
wrappedKeyConf.aes_algorithm               = CCB_AES_CBC;

wrappedKeyConf.key_size                    = 256;
HAL_CCB_ECC_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf, Wrapped_key_Buffer);